package my;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class TxtUploadServer {

	public static void main(String[] args) throws IOException {
		ServerSocket ss = new ServerSocket(8889);
		while(true){
			Socket socket = ss.accept();
			BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\a.txt"));
			String str = "";
			while((str = br.readLine()) != null){
				bw.write(str);
				bw.newLine();
				bw.flush();
			}
			bw.close();
			socket.close();
		}

	}

}
